<?php
namespace Home\Controller;
use Think\Controller;
class CommonController extends Controller {
	public function _initialize(){
		$path = strtolower(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME);
		//echo $path;
		if(in_array($path,C('AUTH_PATH'))){
			if(!isset($_SESSION['uid'])){
				if(IS_AJAX){
					$this->ajaxReturn(['error'=>1,'info'=>'请先登录','url'=>'home/login/index']);
				}else{
					if($_FILES){
						$this->ajaxReturn(['code'=>1,'msg'=>'请先登录']);
					}else{
						$this->error('请先登录',U('home/login/index'));
					}
				}
			}
		}
	}
}